package com.junzhiit.nengji.shop.model.enums;

import com.bainaeco.framework.exception.InvalidArgumentException;

public enum VipIdentity {

	NORMAL(0,"普通用户"),
	VIP(1,"VIP用户"),
	CHANNEL_PARTNER(2,"渠道合伙人");
	
	private Integer value;
	private String text;
	
	private VipIdentity(Integer value,String text) {
		this.value = value;
		this.text = text;
	}
	
	public Integer toIntValue() {
		return this.value;
	}
	
	public String toStringText() {
		return this.text;
	}
	
	public static VipIdentity toValue(int value) {
		if (NORMAL.value == value) {
			return NORMAL;
		} else if (VIP.value == value) {
			return VIP;
		}else if (CHANNEL_PARTNER.value == value) {
			return CHANNEL_PARTNER;
		} else {
			throw new InvalidArgumentException("Unknown vip identity[" + value + "].");
		}
	}
}
